
  Definition for a binary tree node.
  struct TreeNode {
      int val;
      TreeNode left;
      TreeNode right;
      TreeNode(int x)  val(x), left(NULL), right(NULL) {}
  };
 
class Solution {
public
    int ans=0;
    int maxDepth(TreeNode root) {
        dfs(root,0);
        return ans;
    }
    void dfs(TreeNode root,int count){
        if(root==nullptr) return ;
        count++;
        ans=max(count,ans);
        dfs(root-left,count);
        dfs(root-right,count);
    }
};